package com.innovation.wjrpc.protocol;

/**
 * @author innoyiya
 * @date 2021/9/10 15:54
 */
public class StatusCheck {



    public static void setInHand(Response response) {
        response.setCode(Status.IN_HAND.ordinal());
    }

    public static void setTreated(Response response) {
        response.setCode(Status.TREATED.ordinal());
    }

    public static void setFail(Response response) {
        response.setCode(Status.FAIL.ordinal());
    }

    public static boolean isOriginal(Response response) {
        return response.getCode() != Status.TREATED.ordinal();
    }

    public static boolean isInHand(Response response) {
        return response.getCode() == Status.IN_HAND.ordinal();
    }

    public static boolean isTreated(Response response) {
        return response.getCode() == Status.TREATED.ordinal();
    }



}

enum Status{
    ORIGINAL, IN_HAND, TREATED, FAIL
}
